package com.lichuang.springboot.study.lichuangspringbootproject.child;

import com.lichuang.springboot.study.lichuangspringbootproject.parent.LichuangSpringbootProjectApplication;
import com.lichuang.springboot.study.lichuangspringbootproject.parent.Parent;
import com.lichuang.springboot.study.lichuangspringbootproject.parent.failure.Test;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class ChildApplication {
    @Bean
    public Child test(){
        //	throw new NullPointerException();
        return new Child();
    }
    public static void main(String[] args) {
        ConfigurableApplicationContext context=new SpringApplicationBuilder()
                .sources(LichuangSpringbootProjectApplication.class)
                .child(ChildApplication.class)
                .bannerMode(Banner.Mode.OFF)
                .run(args);
        Parent parent=context.getBean(Parent.class);
        System.out.println(parent);
       // SpringApplication.run(ChildApplication.class, args);
    }
}
